<?xml version="1.0" encoding="windows-1251"?>

<xsl:stylesheet version="1.0"  
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> 


<xsl:template match="/">

<script>
//init links array
<xsl:for-each select="apm/links/link">
links["<xsl:value-of select="@from"/>;<xsl:value-of select="@to"/>"] = "<xsl:value-of select="@to"/>";
</xsl:for-each>
//reverse links
<xsl:for-each select="apm/links/link">
links["<xsl:value-of select="@to"/>;<xsl:value-of select="@from"/>"] = "<xsl:value-of select="@from"/>";
</xsl:for-each>

</script>

<table border="0">
<tr style="padding-left: 10px; padding-right: 10px;">
<td nowrap="yes"  style="padding-left: 10px; padding-right: 10px;">
	<br/>
</td>
<td width="100%">
<div id="tooltip_holder">

<xsl:for-each select="apm/apps/app">
	<xsl:element name="div">
	<xsl:attribute name="style">display: none;</xsl:attribute>
	<xsl:attribute name="id">tti_<xsl:value-of select="@name"/></xsl:attribute>
		<table border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="tti_descr" rowspan="5">
					<div class="tti_title"><xsl:value-of select="@name"/> 
						<a target="app_links">
						<xsl:attribute name="href">apm.php?view=links&amp;app=<xsl:value-of select="@name"/></xsl:attribute>
						links
						</a>
					</div>
					<xsl:value-of select="@desc"/>
				</td>
				<td class="tti_name">Owners:</td>
				<td class="tti_value">
					<xsl:for-each select="owner">
						<xsl:value-of select="@name"/>,
					</xsl:for-each>
				</td>
			</tr>
			<tr>
				<td class="tti_name">Work-time:</td>
				<td class="tti_value">
	                <xsl:value-of select="@sla-work-time"/>
				</td>
			</tr>
			<tr>
				<td class="tti_name">Down-time:</td>
				<td class="tti_value">
	                <xsl:value-of select="@sla-down-time"/>
				</td>
			</tr>
			<tr>
				<td class="tti_name">Support:</td>
				<td class="tti_value">
					<xsl:for-each select="manager[@type='sup']">
						<xsl:value-of select="@name"/>,
					</xsl:for-each>
				</td>
			</tr>
			<tr>
				<td class="tti_name">Development:</td>
				<td class="tti_value">
					<xsl:for-each select="manager[@type='dev']">
						<xsl:value-of select="@name"/>,
					</xsl:for-each>
				</td>
			</tr>
		</table>
	</xsl:element>
</xsl:for-each>


</div>
</td>
</tr>
</table>

<table id="map" border = "0" cellspacing="4" cellpadding="4">
    <tr>
        <td colspan="3" >
        	<div id="map_client" class="rounded">
        	<div>Client</div>
                <xsl:for-each select="apm/apps/app[@domain='client']">
					<xsl:call-template name="ShowApp">
						<xsl:with-param name="name" select="@name" />
					</xsl:call-template>
                </xsl:for-each>


        	</div>
        </td>
    </tr>
    
    <tr>
        <td rowspan="3" valign="top" id="map_table_td_v" align="center">
        	<div id="map_crm" class="rounded">
        	    <div>CRM</div>
                <xsl:for-each select="apm/apps/app[@domain='crm']">
					<xsl:call-template name="ShowApp">
						<xsl:with-param name="name" select="@name" />
					</xsl:call-template>
                </xsl:for-each>
        	</div>
        </td>
        <td valign="top" id="map_table_td_h">
        	<div id="map_front" class="rounded">
        	    <div>Front</div>
                <xsl:for-each select="apm/apps/app[@domain='front']">
					<xsl:call-template name="ShowApp">
						<xsl:with-param name="name" select="@name" />
					</xsl:call-template>
                </xsl:for-each>
        	</div>
        </td>
        <td rowspan="3" valign="top" id="map_table_td_v" align="center">
        	<div id="map_dwh" class="rounded">
        	    <div>DWH</div>
                <xsl:for-each select="apm/apps/app[@domain='dwh']">
					<xsl:call-template name="ShowApp">
						<xsl:with-param name="name" select="@name" />
					</xsl:call-template>
                </xsl:for-each>
        	</div>
        </td>
    </tr>

    <tr>
        <td valign="top"  id="map_table_td_h">
        	<div id="map_middle" class="rounded">
        	    <div>Middleware</div>
                <xsl:for-each select="apm/apps/app[@domain='middleware']">
					<xsl:call-template name="ShowApp">
						<xsl:with-param name="name" select="@name" />
					</xsl:call-template>
                </xsl:for-each>
        	</div>
        </td>
    </tr>

    <tr>
        <td valign="top" id="map_table_td_h" >
        	<div id="map_core" class="rounded">
        	    <div>Core</div>
                <xsl:for-each select="apm/apps/app[@domain='core']">
					<xsl:call-template name="ShowApp">
						<xsl:with-param name="name" select="@name" />
					</xsl:call-template>
                </xsl:for-each>
        	</div>
        </td>
    </tr>

    <tr>
        <td colspan="3" >
        	<div id="map_back" class="rounded" >
        	    <div>Back</div>
                <xsl:for-each select="apm/apps/app[@domain='back']">
					<xsl:call-template name="ShowApp">
						<xsl:with-param name="name" select="@name" />
					</xsl:call-template>
                </xsl:for-each>
        	</div>
        </td>
    </tr>
    


</table>

</xsl:template>

<xsl:template name="ShowApp">
	<xsl:param name="name"/>
	
	<table border="0" style="display:inline;">
		<tr>
		<xsl:element name="td">
			<xsl:attribute name="class">mapi_table</xsl:attribute>
			<xsl:attribute name="id">app_<xsl:value-of select="$name"/></xsl:attribute>

			<xsl:element name="div">
				<xsl:attribute name="id">mapi_client</xsl:attribute>
				<xsl:attribute name="class">rounded</xsl:attribute>
				<xsl:attribute name="onclick">showTooltip('<xsl:value-of select="$name"/>');</xsl:attribute>
        			<xsl:value-of select="$name"/>
			</xsl:element>
		</xsl:element>
		</tr>
	</table>
</xsl:template>


</xsl:stylesheet>